package model;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.widget.Toast;

public class Tarefas extends ArrayList<Tarefa> {
	public void parse(JSONArray jsonArray) throws JSONException
	{
		this.clear();
		for (int i = 0; i < jsonArray.length(); i++) {
			JSONObject o = jsonArray.getJSONObject(i);
			Tarefa t = new Tarefa();
			t.setId(o.getInt("id"));
			t.setDescr(o.getString("descr"));
			t.setHorario(o.getString("horario"));
			t.setLatitude(o.getString("latitude"));
			t.setLocal(o.getString("local"));
			t.setLongitude(o.getString("longitude"));
			t.setUrl(o.getString("url"));
			t.setCid(o.getInt("cid"));
			this.add(t);
		}
	}
}
